expiration_of_transient_{$transient}
Filter HookDescription
Filters the expiration for a transient before its value is set. The dynamic portion of the hook name, `$transient`, refers to the transient name.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1539 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$expiration
|
Time until expiration in seconds. Use 0 for no expiration. |
mixed
|
$value
|
New value of transient. |
string
|
$transient
|
Transient name. |
Usage Examples
Basic Usage
<?php
// Hook into expiration_of_transient_{$transient}
add_filter('expiration_of_transient_{$transient}', 'my_custom_filter', 10, 3);
function my_custom_filter($expiration, $value, $transient) {
// Your custom filtering logic here
return $expiration;
}
Source Code Context
wp-includes/option.php:1539
- How this hook is used in WordPress core
<?php
1534 *
1535 * @param int $expiration Time until expiration in seconds. Use 0 for no expiration.
1536 * @param mixed $value New value of transient.
1537 * @param string $transient Transient name.
1538 */
1539 $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );
1540
1541 if ( wp_using_ext_object_cache() || wp_installing() ) {
1542 $result = wp_cache_set( $transient, $value, 'transient', $expiration );
1543 } else {
1544 $transient_timeout = '_transient_timeout_' . $transient;
PHP Documentation
<?php
/**
* Filters the expiration for a transient before its value is set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 4.4.0
*
* @param int $expiration Time until expiration in seconds. Use 0 for no expiration.
* @param mixed $value New value of transient.
* @param string $transient Transient name.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.